package com.eduhzy.ttw.clazz.mvp.model.entity;

import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * @author xubo
 * @date 2018/12/5 13:12
 */
public class ClazzReviewIcon implements Parcelable {

    /**
     * id : 0
     * scoreType : 0
     * url :
     */

    private int id;
    private int scoreType;
    private int url;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getScoreType() {
        return scoreType;
    }

    public void setScoreType(int scoreType) {
        this.scoreType = scoreType;
    }

    public int getUrl(Context mContext) {
        int drawable = mContext.getResources().getIdentifier("icon_" + url, "drawable", mContext.getPackageName());
        return drawable;
    }

    public void setUrl(int url) {
        this.url = url;
    }

    public ClazzReviewIcon() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.id);
        dest.writeInt(this.scoreType);
        dest.writeInt(this.url);
    }

    protected ClazzReviewIcon(Parcel in) {
        this.id = in.readInt();
        this.scoreType = in.readInt();
        this.url = in.readInt();
    }

    public static final Creator<ClazzReviewIcon> CREATOR = new Creator<ClazzReviewIcon>() {
        @Override
        public ClazzReviewIcon createFromParcel(Parcel source) {
            return new ClazzReviewIcon(source);
        }

        @Override
        public ClazzReviewIcon[] newArray(int size) {
            return new ClazzReviewIcon[size];
        }
    };
}
